home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 January / macformat-033.iso / mac / Shareware City / Developers / ABox.v1.8 / Header Files / ABLinkedList.h next >
Encoding:
C/C++ Source or Header  |  1995-05-23  |  4.7 KB  |  169 lines  |  [TEXT/MMCC]

  1. /*    
  2.     Copyright © 1991-1995 by TopSoft Inc.  All rights reserved.
  3.  
  4.     You may distribute this file under the terms of the TopSoft
  5.     Artistic License, accompanying this package.
  6.     
  7.     This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
  8.     See the Modification History for more details.
  9.  
  10. Product
  11.     About Box
  12.  
  13. FILE
  14.     ABLinkedList.h
  15.  
  16. NAME
  17.     ABLinkedList.h, part of the ABox project source code,
  18.     responsible for handling the AboutBox linked list class stuff.
  19.  
  20. DESCRIPTION
  21.     This file contains defines for the about box modules.
  22.     
  23. DEVELOPED BY
  24.     George (ty) Tempel                netromancr@aol.com
  25.     All code in this file, and its associated header file was
  26.     Created by George (ty) Tempel in connection with the TopSoft, Inc.
  27.     "FilterTop" application development, except where noted.
  28.  
  29. CARETAKER - George (ty) Tempel <netromancr@aol.com>
  30.      Please consult this person for any changes or suggestions to this file.
  31.  
  32. MODIFICATION HISTORY
  33.  
  34.     dd mmm yy    -    xxx    -    patchxx: description of patch
  35.     9 June 94    -    ty    -    Initial Version Created
  36.     20-july-94    -    ty    -    initial version released
  37.     23-may-95    -    ty    -    changes for compatibility with the CodeWarrior CW6
  38.                             release and the associated Universal Headers from Apple:
  39.                             most methods that returned references now have "Ref" at
  40.                             the end of their methods names to prevent possible collisions
  41.                             with datatypes and classes of the same name (older versions
  42.                             of the compiler didn't have a problem with this).
  43. */
  44.  
  45. /*===========================================================================*/
  46.  
  47. /*========== Exclusion Macros ============*/
  48.  
  49. #pragma    once
  50.  
  51. #ifndef    _ABLinkedList_
  52. #define    _ABLinkedList_
  53.  
  54.  
  55. /*============ Header Files ==============*/
  56.  
  57.  
  58. /*=========== External Linkage ===========*/
  59.  
  60. /*================ Macros ================*/
  61.  
  62. /*============== Constants ===============*/
  63.  
  64. /*================ Enums =================*/
  65.  
  66. /*=============== Structs ================*/
  67.  
  68. /*=============== Typedefs ===============*/
  69.  
  70. typedef    long    ABListCount;
  71. typedef    long    ABIndex;
  72.  
  73. typedef    long    ABMessage;
  74.  
  75.  
  76. /*=========== Class Definitions ==========*/
  77.  
  78. //class    ABLink : ABProperties
  79. class    ABLink
  80. {
  81.     friend class ABLinkedList;
  82.     
  83.     public:
  84.                         ABLink();
  85.         virtual            ~ABLink();
  86.     
  87.         virtual    void    Unlink(void);
  88.     
  89.         virtual    ABIndex    Ordinal(void);
  90.         
  91.         virtual    ABLink    *ExchangeWith (ABLink *itemToSwapIn);
  92.         
  93.                 Boolean HasPreviousLink(void) const { return this->PreviousLink() != NULL; }
  94.                 Boolean HasNextLink(void) const { return this->NextLink() != NULL; }
  95.                 Boolean HasThisLink(void) const { return this->ThisLink() != NULL; }
  96.                 
  97.                 Boolean DoesntHavePreviousLink(void) const { return ! this->HasPreviousLink(); }
  98.                 Boolean DoesntHaveNextLink(void) const { return ! this->HasNextLink(); }
  99.                 Boolean DoesntHaveThisLink(void) const { return ! this->HasThisLink(); }
  100.                 
  101.     protected:
  102.         virtual    ABLink    *FindHead(void);
  103.         virtual    ABLink    *FindTail(void);
  104.         virtual    void    *Data(void);
  105.         
  106.                 ABLink    *mPreviousLink;
  107.                 ABLink    *mThisLink;
  108.                 ABLink    *mNextLink;
  109.                 
  110.                 ABLink*&    PreviousLink(void) const { return mPreviousLink; }
  111.                 ABLink*&    ThisLink(void) const { return mThisLink; }
  112.                 ABLink*&    NextLink(void) const { return mNextLink; }
  113.  
  114.     private:
  115. };
  116.  
  117.  
  118.  
  119. class    ABLinkedList
  120. {
  121.     public:
  122.                         ABLinkedList(void);
  123.         virtual            ~ABLinkedList(void);
  124.         
  125.                 ABListCount        Count(void) const { return this->ListCount(); }
  126.         virtual    ABLinkedList    *Append(ABLink *item);
  127.         virtual    ABLinkedList    *Detach(ABLink *item);
  128.         virtual    ABLink    *NthLink(ABIndex n);
  129.         virtual    ABLink    *NextLink(void);
  130.         virtual    ABLink    *PreviousLink(void);
  131.         
  132.         virtual    ABLink    *FirstLink(void);
  133.         virtual    ABLink    *LastLink(void);
  134.         virtual    ABLink    *GetCurrentLink(void) const { return this->CurrentLink(); }
  135.         virtual    ABLink    *GotoLink(ABIndex number);
  136.         
  137.         virtual    OSErr    ForEach (ABMessage message, void *data);
  138.         
  139.                 Boolean HasListItems(void) const { return this->ListCount() > 0; }
  140.                 Boolean DoesntHaveListItems(void) const { return ! this->HasListItems(); }
  141.                 Boolean IsEmpty(void) const { return this->DoesntHaveListItems(); }
  142.                 Boolean IsNotEmpty(void) const { return ! this->IsEmpty(); }
  143.                 Boolean IsntEmpty(void) const { return this->IsNotEmpty(); }
  144.                 
  145.                 Boolean HasCurrentLink(void) const { return this->CurrentLink() != NULL; }
  146.                 Boolean DoesntHaveCurrentLink(void) const { return ! this->HasCurrentLink(); }
  147.                 
  148.     protected:
  149.                 ABListCount        mListCount;
  150.                 ABLink            mHead;
  151.                 ABLink*            mCurrentLink;
  152.                 ABLink            mTail;
  153.  
  154.                 ABListCount&    ListCount(void) const { return mListCount; }
  155.                 ABLink&            Head(void) const { return mHead; }
  156.                 ABLink*&        CurrentLink(void) const { return mCurrentLink; }
  157.                 ABLink&            Tail(void) const { return mTail; }
  158.  
  159.     private:                
  160. };
  161.  
  162. /*========== Function Prototypes =========*/
  163.  
  164.  
  165.  
  166.  
  167. #endif    // _ABLinkedList_
  168.  
  169.